﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:MediaKit="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:LaserTag_Common_Behaviors="clr-namespace:LaserTag.Common.Behaviors;assembly=LaserTag.Common"
             x:Class="LaserTag.Module.MediaKit.Views.VideoCaptureView"
             Margin="15"
             mc:Ignorable="d"
             d:DesignWidth="693"
             d:DesignHeight="504">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/LaserTag.Common;Component/Themes/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Storyboard x:Key="CameraOptionsShow">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                               Storyboard.TargetName="grid"
                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                          Value="1" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="CameraOptionsHide">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                               Storyboard.TargetName="grid"
                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </ResourceDictionary>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="Mouse.MouseEnter"
                      SourceName="border">
            <BeginStoryboard Storyboard="{StaticResource CameraOptionsShow}" />
        </EventTrigger>
        <EventTrigger RoutedEvent="Mouse.MouseLeave"
                      SourceName="border">
            <BeginStoryboard x:Name="CameraOptionsHide_BeginStoryboard"
                             Storyboard="{StaticResource CameraOptionsHide}" />
        </EventTrigger>
    </UserControl.Triggers>
    <Grid>
        <Border BorderThickness="1"
                CornerRadius="8"
                Margin="0">
            <Border Margin="0">
                <Border BorderThickness="1"
                        CornerRadius="6" />
            </Border>
        </Border>
        <Border Margin="8"
                BorderThickness="1"
                CornerRadius="2"
                HorizontalAlignment="Center"
                VerticalAlignment="Top"
                Width="516">
            <Border BorderThickness="10"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center">
                <Border.BorderBrush>
                    <LinearGradientBrush EndPoint="0.815,0.799"
                                         StartPoint="0.185,0.201">
                        <GradientStop Color="White"
                                      Offset="0" />
                        <GradientStop Color="#FFC7C7C7"
                                      Offset="1" />
                    </LinearGradientBrush>
                </Border.BorderBrush>
                <Border x:Name="border"
                        BorderThickness="2"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Background="#00000000">
                    <Grid>
                        <MediaKit:VideoCaptureElement LoadedBehavior="Play"
                                                      RenderOptions.BitmapScalingMode="LowQuality"
                                                      UnloadedBehavior="Manual"
                                                      DesiredPixelWidth="{Binding DesiredPixelWidth}"
                                                      DesiredPixelHeight="{Binding DesiredPixelHeight}"
                                                      VideoCaptureDevice="{Binding SelectedItem, ElementName=videoCapDevices}"
                                                      FPS="30"
                                                      EnableSampleGrabbing="True"
                                                      NewVideoSample="VideoCaptureElement_NewVideoSample"
                                                      Margin="0"
                                                      x:Name="videoElement"
                                                      Stretch="Fill"
                                                      MinHeight="380"
                                                      MinWidth="500" />
                        <Grid x:Name="grid"
                              d:LayoutOverrides="Width, Height">
                            <Border Background="#97000000"
                                    BorderThickness="0" />
                            <Border BorderThickness="0">
                                <Border.Background>
                                    <RadialGradientBrush Center="0.067,0.054"
                                                         GradientOrigin="0.067,0.054"
                                                         RadiusY="0.658">
                                        <GradientStop Color="#00000000"
                                                      Offset="1" />
                                        <GradientStop Color="#64FFFFFF" />
                                    </RadialGradientBrush>
                                </Border.Background>
                            </Border>
                            <Button Command="MediaKit:VideoCaptureElement.ShowPropertyPagesCommand"
                                    VerticalAlignment="Bottom"
                                    CommandTarget="{Binding ElementName=videoElement}"
                                    HorizontalAlignment="Right"
                                    Style="{DynamicResource InfoButton}"
                                    Margin="0,0,10,10" />
                            <ListBox x:Name="videoCapDevices"
                                     ItemsSource="{Binding Source={x:Static MediaKit:MultimediaUtil.VideoInputDevices}}"
                                     DisplayMemberPath="Name"
                                     Foreground="White"
                                     VerticalAlignment="Bottom"
                                     Margin="0"
                                     Background="{x:Null}"
                                     BorderBrush="{x:Null}"
                                     HorizontalAlignment="Left"
                                     Height="60"
                                     FontFamily="Segoe UI Semibold"
                                     FontSize="10.667" />
                        </Grid>
                    </Grid>
                </Border>
            </Border>
        </Border>
    </Grid>
</UserControl>
